package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ProductPassCardManagementMapper;
import com.ruoyi.system.domain.ProductPassCardManagement;
import com.ruoyi.system.service.IProductPassCardManagementService;

/**
 * 商品次卡管理 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-22
 */
@Service
public class ProductPassCardManagementServiceImpl implements IProductPassCardManagementService
{
    @Autowired
    private ProductPassCardManagementMapper productPassCardManagementMapper;

    /**
     * 通过id查询商品次卡管理
     *
     * @param id 商品次卡管理主键
     * @return 商品次卡管理
     */
    @Override
    public ProductPassCardManagement selectProductPassCardManagementById(Long id)
    {
        return productPassCardManagementMapper.selectProductPassCardManagementById(id);
    }

    /**
     * 通过次卡名称和状态查询商品次卡管理列表
     *
     * @param cardName,status 次卡名称，状态
     * @return 商品次卡管理
     */
    @Override
    public List<ProductPassCardManagement> selectProductPassCardManagementList(String cardName,String status)
    {
        return productPassCardManagementMapper.selectProductPassCardManagementList(cardName,status);
    }

    /**
     * 新增商品次卡管理
     *
     * @param productPassCardManagement 商品次卡管理
     * @return 结果
     */
    @Override
    public int insertProductPassCardManagement(ProductPassCardManagement productPassCardManagement)
    {
        productPassCardManagement.setCreateTime(DateUtils.getNowDate());
        return productPassCardManagementMapper.insertProductPassCardManagement(productPassCardManagement);
    }

    /**
     * 修改商品次卡管理
     *
     * @param productPassCardManagement 商品次卡管理
     * @return 结果
     */
    @Override
    public int updateProductPassCardManagement(ProductPassCardManagement productPassCardManagement)
    {
        productPassCardManagement.setUpdateTime(DateUtils.getNowDate());
        return productPassCardManagementMapper.updateProductPassCardManagement(productPassCardManagement);
    }

    /**
     * 通过id批量删除商品次卡管理信息
     *
     * @param ids 需要删除的商品次卡管理主键
     * @return 结果
     */
    @Override
    public int deleteProductPassCardManagementByIds(Long[] ids)
    {
        return productPassCardManagementMapper.deleteProductPassCardManagementByIds(ids);
    }

    /**
     * 通过id删除商品次卡管理信息
     *
     * @param id 商品次卡管理主键
     * @return 结果
     */
    @Override
    public int deleteProductPassCardManagementById(Long id)
    {
        return productPassCardManagementMapper.deleteProductPassCardManagementById(id);
    }
}
